package com.dy.design_pattern_study.interpreter_pattern.dome2.impl;

import com.dy.design_pattern_study.interpreter_pattern.dome2.Expression;

/**
 * @CreateBy zhangdingyi
 * @Date 2023-04-24
 * @Content 音符解析器
 */
public class Note extends Expression {
    @Override
    public void excute(String key, double value) {
        String note = "";
        //如果获得的key是C则演奏  i，如果是D 则演奏2
        switch (key) {
            case "C":
                note = "1";
                break;
            case "D":
                note = "2";
                break;
            case "E":
                note = "3";
                break;
            case "F":
                note = "4";
                break;
            case "G":
                note = "5";
                break;
            case "A":
                note = "6";
                break;
            case "B":
                note = "7";
                break;
        }
        System.out.println(" note = " + note);
    }
}
